package net.bolue.sysmng.util;

public class PageVo {

	//排序字段名
	private String sortname;
	
	//排序方式
	private String sortorder;
	
	//开始记录号
	private Integer firstResult;
	
	//每页最大记录数
	private Integer maxResults;
	
	//当前页
	private Integer nowPage;
	
	
	//总记录数
	private Integer totalcount;
	
	//总页数
	private Integer totalPage;

	//分页访问地址
	private String url;
	
	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getSortname() {
		return sortname;
	}

	public void setSortname(String sortname) {
		this.sortname = sortname;
	}

	public String getSortorder() {
		return sortorder;
	}

	public void setSortorder(String sortorder) {
		this.sortorder = sortorder;
	}

	public Integer getFirstResult() {
		return firstResult;
	}

	public void setFirstResult(Integer firstResult) {
		this.firstResult = firstResult;
	}

	public Integer getMaxResults() {
		return maxResults;
	}

	public void setMaxResults(Integer maxResults) {
		this.maxResults = maxResults;
	}

	public Integer getNowPage() {
		return nowPage;
	}

	public void setNowPage(Integer nowPage) {
		this.nowPage = nowPage;
	}

	public Integer getTotalcount() {
		return totalcount;
	}

	public void setTotalcount(Integer totalcount) {
		this.totalcount = totalcount;
		deal();
	}

	public Integer getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}
	
	public void deal(){
		if(this.maxResults==null||this.maxResults==0){
			this.maxResults = 10;
		}
		if(this.totalcount==null){
			this.totalPage = 1;
		}else{
			if(this.totalcount%this.maxResults==0){
				this.totalPage = this.totalcount/this.maxResults;
			}else{
				this.totalPage = this.totalcount/this.maxResults+1;
			}
		}
		if(this.nowPage==null){
			this.nowPage=1;
		}
		this.firstResult=(this.nowPage-1)*this.maxResults;
	}

}
